package com.code.common.nosql;

import java.net.UnknownHostException;

import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBAddress;
import com.mongodb.DBCollection;
import com.mongodb.Mongo;

public class MongodbTest {

	public static void main(String[] args) throws UnknownHostException {
		DBAddress objMongoConn=new DBAddress("127.0.0.1",27017,"Test");
        DB db = Mongo.connect(objMongoConn);
		BasicDBObject obj = new BasicDBObject();
		obj.put("ttt", "aaaaaaaaaaaaaaaaaaaaaaaaaaaa");
		obj.put("ttta", "aaaaaaaaaaaaaaaaaadffffffffffff");
		DBCollection objDBCollection = db.getCollection("aaa");
        objDBCollection.save(obj);
        db.getMongo().close();
	}
}
